package com.ruoyi.backend.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.backend.mapper.TServiceMapper;
import com.ruoyi.backend.domain.TService;
import com.ruoyi.backend.service.ITServiceService;

/**
 * 服务Service业务层处理
 * 
 * @author wjr
 * @date 2025-09-23
 */
@Service
public class TServiceServiceImpl implements ITServiceService 
{
    @Autowired
    private TServiceMapper tServiceMapper;

    /**
     * 查询服务
     * 
     * @param id 服务主键
     * @return 服务
     */
    @Override
    public TService selectTServiceById(Integer id)
    {
        return tServiceMapper.selectTServiceById(id);
    }

    /**
     * 查询服务列表
     * 
     * @param tService 服务
     * @return 服务
     */
    @Override
    public List<TService> selectTServiceList(TService tService)
    {
        return tServiceMapper.selectTServiceList(tService);
    }

    /**
     * 新增服务
     * 
     * @param tService 服务
     * @return 结果
     */
    @Override
    public int insertTService(TService tService)
    {
        tService.setCreateBy(SecurityUtils.getUsername());
        tService.setCreateTime(DateUtils.getNowDate());
        return tServiceMapper.insertTService(tService);
    }

    /**
     * 修改服务
     * 
     * @param tService 服务
     * @return 结果
     */
    @Override
    public int updateTService(TService tService)
    {
        tService.setUpdateBy(SecurityUtils.getUsername());
        tService.setUpdateTime(DateUtils.getNowDate());
        return tServiceMapper.updateTService(tService);
    }

    /**
     * 批量删除服务
     * 
     * @param ids 需要删除的服务主键
     * @return 结果
     */
    @Override
    public int deleteTServiceByIds(Integer[] ids)
    {
        return tServiceMapper.deleteTServiceByIds(ids);
    }

    /**
     * 删除服务信息
     * 
     * @param id 服务主键
     * @return 结果
     */
    @Override
    public int deleteTServiceById(Integer id)
    {
        return tServiceMapper.deleteTServiceById(id);
    }
}
